package com.fenqile.api.pop.testcase;

import java.util.List;
import java.util.Map;
import java.util.TreeMap;

import org.apache.commons.codec.digest.DigestUtils;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.fenqile.api.pop.parameter.FQLBaseParam;
import com.fenqile.api.pop.parameter.FenqileProductListGetBean;
import com.fenqile.api.pop.parameter.Product;
import com.fenqile.api.pop.service.FenqilePopCall;
import com.ymatou.common.lang.CipherUtil;
import com.ymt.core.tool.FormatUtil;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.FQLOpenCallService;
import com.ymttest.utils.TestDataManager;
import com.ymttest.utils.YMTDateUtil;
/**
*分期乐商品查询list
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_FenqilePop{
	private static FenqileProductListGetBean fenqileproductlistgetBean;
	private static FenqilePopCall fenqileproductlistgetCall;
	private static FQLBaseParam FQLBaseParam;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("分期乐商品查询list");
	}

	@Before
	public void caseUp() {
		fenqileproductlistgetBean=new FenqileProductListGetBean();
		fenqileproductlistgetCall=new FenqilePopCall();
		FQLBaseParam=new FQLBaseParam();
		FQLBaseParam.setFormat("json");
		FQLBaseParam.setPartner_id(FQLOpenCallService.PartnerId);
		FQLBaseParam.setV("1.3");
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(fenqileproductlistgetCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_FenqileProductListGet_001() {
		Logger.start(true,"分期乐查询商品列表信息");
		try {
			fenqileproductlistgetBean.setFields("product_id,category_id,product_name,brand_id,create_time,spu_status,pic_list,service,start_time,end_time,third_product_id");
			fenqileproductlistgetBean.setPage(1);
			fenqileproductlistgetBean.setPage_size(100);
			Logger.debug(FQLOpenCallService.FenqilePopCall("fenqile.product.list.get", fenqileproductlistgetBean));
			List<Product> fenqilePopCallToObject = FQLOpenCallService.FenqilePopCallToObject("fenqile.product.list.get", fenqileproductlistgetBean);
			fenqilePopCallToObject.forEach(b->{
				System.out.println(b);
			});
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_FenqileCategory_002() {
		Logger.start(true,"分期乐获取商家被授权的类目列表");
		try {
			Logger.debug(FQLOpenCallService.FenqilePopCall("fenqile.category.authorize.get", null));
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_FenqileCategory_003() {
		Logger.start(true,"分期乐获取商家被授权的品牌列表");
		try {
			Logger.debug(FQLOpenCallService.FenqilePopCall("fenqile.brand.authorize.get", null));
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_FenqileCategory_004() {
		Logger.start(true,"获取商家被授权的商品属性列表");
		try {
			Logger.debug(FQLOpenCallService.FenqilePopCall("fenqile.product.feature.get", null));
		} catch (Exception e) {
			Logger.fail(e); 
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_FenqileCategory_005() {
		Logger.start(true,"获取商家被授权的商品属性列表");
		try {
			Logger.debug(FQLOpenCallService.FenqilePopCall("fenqile.product.feature.get", null));
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_FenqileCategory_006() {
		Logger.start(true,"获取商家被授权的销售属性列表");
		try {
			Logger.debug(FQLOpenCallService.FenqilePopCall("fenqile.sku.feature.get", null));
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_FenqileProductListGet_007() {
		Logger.start(true,"分期乐查询商品列表信息");
		try {
			fenqileproductlistgetBean.setProduct_id("P201910250579536");
			fenqileproductlistgetBean.setFields("product_id,category_id,product_name,brand_id,create_time,spu_status,pic_list,service,start_time,end_time,third_product_id,sku_id,spec");
			fenqileproductlistgetBean.setPage(1);
			fenqileproductlistgetBean.setPage_size(100);
			Logger.debug(FQLOpenCallService.FenqilePopCall("fenqile.product.detail.get", fenqileproductlistgetBean));
			Product fenqilePopCallToObject = FQLOpenCallService.FenqilePopCallTodetail("fenqile.product.detail.get", fenqileproductlistgetBean);
			System.out.println(fenqilePopCallToObject);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_FenqileProductListGet_008() {
		Logger.start(true,"分期乐查询商品列表信息");
		try {
			fenqileproductlistgetBean.setProduct_id("P201911010580357");
			fenqileproductlistgetBean.setFields("product_id,category_id,product_name,brand_id,create_time,spu_status,pic_list,service,start_time,end_time,third_product_id,sku_ids");
			fenqileproductlistgetBean.setPage(1);
			fenqileproductlistgetBean.setPage_size(100);
			Logger.debug(FQLOpenCallService.FenqilePopCall("fenqile.product.detail.get", fenqileproductlistgetBean));
			Product fenqilePopCallToObject = FQLOpenCallService.FenqilePopCallTodetail("fenqile.product.detail.get", fenqileproductlistgetBean);
			System.out.println(fenqilePopCallToObject);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}